{% extends "base.html" %}
{% load static %}
{% block header-css %}
<script src="{% static 'css/plugins/datepicker/datepicker3.css' %}"></script>
{% endblock %}
{% block  title %}任务结果{% endblock %}

{% block page-content %}



    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>任务结果</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="/index.html">主页</a>
                </li>
                <li>
                    <a>作业中心</a>
                </li>
                <li class="active">
                    <strong>任务结果</strong>
                </li>
            </ol>
        </div>
        <div class="col-lg-2">

        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>任务结果</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li><a href="#">选项 1</a>
                                </li>
                                <li><a href="#">选项 2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

<div class="row">


                     <form id="search_form" method="get" action="" class="pull-left form-inline">
                    <div class="form-group" id="date">
                        <div class="input-daterange input-group" id="datepicker">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            <input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from  }}">
                            <span class="input-group-addon">to</span>
                            <input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to  }}">
                        </div>
                    </div>
{#        <div class="input-group">#}
{#            <input type="text" class="form-control input-sm" name="keyword" placeholder="搜索" value="">#}
{#        </div>#}
        <div class="input-group">
            <div class="input-group-btn">
                <button id='search_btn' type="submit" class="btn btn-sm btn-primary">
                   搜索
                </button>
            </div>
        </div>
    </form>
</div>

                          <div class="table-responsive">

                                <table class="table table-striped table-bordered table-hover dataTables-example-tools">
                                    <thead>
                                    <tr>
                                        <th width="20">ID</th>
                                        <th>返回结果</th>
                                        <th>traceback</th>
                                        <th>结果</th>
                                        <th>hidden</th>
                                        <th>创建时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    {% for   row   in  periodictassks_results_list.object_list %}

                                        <tr class="gradeA" >
                                            <td class="center"><div class="label label-success">{{ row.id }}</div></td>
                                            <td class="center">{{ row.result }}</td>

                                            <td class="center " ><div class="label label-primary">{{ row.status }}</div></td>
                                           <td class="center">{{ row.traceback }}</td>
                                            <td class="center">{{ row.hidden }}</td>
                                            <td class="center">{{ row.date_done }}</td>

                                        </tr>
                                    {% endfor %}

                                    </tbody>


                                </table>


   <div style="text-align:center;">
<nav class="pagination">


         <li><a href="{% url "crontabs:periodictasks_result" %}?page=1">首页 </a></li>

            {% if periodictassks_results_list.has_previous %}
                <li class="long"><a href="?{{ periodictassks_results_list.previous_page_number.querystring }}">上一页</a></li>
            {% endif %}

            {% for page in periodictassks_results_list.pages %}
            {% if page %}
                {% ifequal page periodictassks_results_list.number %}
                    <li class="active"><a href="?{{ page.querystring }}">{{ page }}</a></li>
                {% else %}
                     <li><a href="?{{ page.querystring }}" class="page">{{ page }}</a></li>
                {% endifequal %}
            {% else %}
                <li class="none"><a href="">...</a></li>
            {% endif %}
            {% endfor %}
            {% if periodictassks_results_list.has_next %}
                <li class="long"><a href="?{{ periodictassks_results_list.next_page_number.querystring }}">下一页</a></li>
            {% endif %}
  <li>
                                                <a href="{% url "crontabs:periodictasks_result" %}?page={{ periodictassks_results_list.paginator.num_pages }}">尾页 </a>
                                            </li>
                                            <li><span style="color: #0a0a0a">总: &nbsp;{{ periodictassks_results_list.paginator.num_pages }} 页 </span>
                                            </li>

</nav>
  </div>


                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>



{% block footer-js %}
   <script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
   $(document).ready(function () {

        $('#date .input-daterange').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            autoclose: true
    });

         $('.dataTables-example-tools').DataTable({


                    "oLanguage": {
                        "sLengthMenu": "每页显示 _MENU_ 条记录",
                        "sZeroRecords": "对不起，查询不到任何相关数据",
                        "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_条记录",
                        "sInfoEmtpy": "找不到相关数据",
                        "sInfoFiltered": " 数据表中共为 _MAX_ 条记录",
                        "sProcessing": "正在加载中...",
                        "sSearch": "搜索",
                        "oPaginate": {
                            "sFirst": "第一页",
                            "sPrevious": " 上一页 ",
                            "sNext": " 下一页 ",
                            "sLast": " 最后一页 "
                        }
                    },
                    "order": [[1, 'desc']],
                    destroy: true,


                    bPaginate: false,
                    dom: '<"html5buttons"B>lTfgitp,'

                });
            });




    </script>
{% endblock %}

{% endblock %}